/*
** Lua binding: tClass
** Generated automatically by tolua++-1.0.92 on 05/22/14 23:41:46.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "LuaAndToLua++/tolua++.h"

/* Exported function */
TOLUA_API int  tolua_tClass_open (lua_State* tolua_S);

#include "tClass.h"

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_A (lua_State* tolua_S)
{
 A* self = (A*) tolua_tousertype(tolua_S,1,0);
	Mtolua_delete(self);
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"A");
}

/* get function: a of class  A */
#ifndef TOLUA_DISABLE_tolua_get_A_a
static int tolua_get_A_a(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->a);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: a of class  A */
#ifndef TOLUA_DISABLE_tolua_set_A_a
static int tolua_set_A_a(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->a = ((int)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* method: new of class  A */
#ifndef TOLUA_DISABLE_tolua_tClass_A_new00
static int tolua_tClass_A_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"A",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  int nTemp = ((int)  tolua_tonumber(tolua_S,2,0));
  {
   A* tolua_ret = (A*)  Mtolua_new((A)(nTemp));
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"A");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  A */
#ifndef TOLUA_DISABLE_tolua_tClass_A_new00_local
static int tolua_tClass_A_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"A",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  int nTemp = ((int)  tolua_tonumber(tolua_S,2,0));
  {
   A* tolua_ret = (A*)  Mtolua_new((A)(nTemp));
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"A");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: Get of class  A */
#ifndef TOLUA_DISABLE_tolua_tClass_A_Get00
static int tolua_tClass_A_Get00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"A",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Get'", NULL);
#endif
  {
   int tolua_ret = (int)  self->Get();
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
TOLUA_API int tolua_tClass_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"A","A","",tolua_collect_A);
  #else
  tolua_cclass(tolua_S,"A","A","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"A");
   tolua_variable(tolua_S,"a",tolua_get_A_a,tolua_set_A_a);
   tolua_function(tolua_S,"new",tolua_tClass_A_new00);
   tolua_function(tolua_S,"new_local",tolua_tClass_A_new00_local);
   tolua_function(tolua_S,".call",tolua_tClass_A_new00_local);
   tolua_function(tolua_S,"Get",tolua_tClass_A_Get00);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 TOLUA_API int luaopen_tClass (lua_State* tolua_S) {
 return tolua_tClass_open(tolua_S);
};
#endif

